package com.javaGame.util;

import com.javaGame.GameMap;
import com.javaGame.frame.MainFrame;
import com.javaGame.role.enemy.Light;
import com.javaGame.role.enemy.RedEnemy;

/**
 * 产生敌人
 */
public class CreateEnemy {
    /**红怪计数器*/
    private int redCount;
    /**灯怪计数器*/
    private int lightCount;

    public void create(){
        this.createRedEnemey();
        this.createLight();
    }

    /**
     * 产生红色怪物
     */
    private void createRedEnemey(){
        redCount ++;
        if(redCount > 150){
            redCount = 0;
            //产生随机数量
            int num = (int)(Math.random()*3 + 1);
            for(int i=0;i<num;i++){
                MainFrame.roleList.add(new RedEnemy());
            }
        }
    }

    /**
     * 产生灯怪
     */
    private void createLight(){
        lightCount++;

        if(lightCount > 100 && GameMap.mapx > - 3000 && GameMap.mapx < -100){
            lightCount = 0;
            MainFrame.roleList.add(new Light());
        }
    }
}
